//
//  auditController.m
//  FastDoctor
//
//  Created by 云卷云舒丶 on 16/7/7.
//  Copyright © 2016年 sc. All rights reserved.
//

#import "auditController.h"

@interface auditController ()

@property(nonatomic,strong)NSArray <applyModel *> * dataArray;

@end

@implementation auditController


- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"预约医生信息详情";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setupUI];
}
-(void)setupUI{
    
    [self sickPersonUI ];
    [self doctorUI];
    
}

//-(void)setModel:(applyModel *)model{
//    _model =model;
//
//    //    病人名
//    _sickPersonName.text = model.sickPersonName;
//    //    病名
//    _diseaseName.text = model.diseaseName;
//    //    就诊时间
//    _seeDoctorTime.text = model.seeDoctorTime;
//    //    医生名
//    _doctorName.text = model.doctorName;
//    //    医生职位
//    _doctorPosition.text = model.doctorPosition;
//    //    医院名
//    _hospitalName.text = model.hospitalName;
//
//}

//设置病人区域
-(void)sickPersonUI{
    
    //    病人头像
    UIImageView * sickPersonIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"banner"]];
    [self.view addSubview:sickPersonIcon];
    [sickPersonIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(74);
        make.left.equalTo(self.view).offset(10);
        make.height.and.width.equalTo(@80);
        
    }];
    //病人名
    UILabel * sickPersonName = [[UILabel alloc]init];
    self.sickPersonName = sickPersonName;
    [self.view addSubview:sickPersonName];
    [sickPersonName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(80);
        make.left.equalTo(sickPersonIcon.mas_right).offset(10);
    }];
    //    病名
    UILabel * diseaseName = [[UILabel alloc]init];
    self.diseaseName = diseaseName;
    diseaseName.text = @"高血压";
    diseaseName.textColor = [UIColor grayColor];
    [self.view addSubview:diseaseName];
    [diseaseName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(80);
        make.left.equalTo(sickPersonName.mas_right).offset(10);
    }];
    //    就诊时间
    UILabel * seeDoctorTime = [[UILabel alloc]init];
    self.seeDoctorTime =seeDoctorTime;
    seeDoctorTime.text = @"就诊时间：2016/07/01";
    seeDoctorTime.textColor = [UIColor grayColor];
    
    [self.view addSubview:seeDoctorTime];
    [seeDoctorTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(sickPersonName.mas_bottom).offset(25);
        make.left.equalTo(sickPersonIcon.mas_right).offset(10);
    }];
    
    UIButton * stateButton = [[UIButton alloc]init];
    self.stateButton = stateButton;
    [stateButton setTitle:@"审核中" forState:UIControlStateNormal];
    stateButton.backgroundColor = [UIColor colorWithRed:57/255.0 green:197/255.0 blue:196/255.0 alpha:1];
    [self.view addSubview:stateButton];
    [stateButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(74);
        make.right.equalTo(self.view).offset(-10);
        make.height.and.width.equalTo(@80);
        
    }];
    stateButton.layer.cornerRadius= 40;
    
    
    UIView * threadView = [[UIView alloc]init];
    threadView.backgroundColor = [UIColor grayColor];
    [self.view addSubview:threadView];
    
    [threadView mas_makeConstraints:^(MASConstraintMaker *make) {
        //        线宽
        make.height.mas_equalTo(1);
        //        设置整条宽度
        make.width.mas_equalTo(self.view);
        make.top.equalTo(stateButton.mas_bottom).offset(20);
        
    }];
    
    UILabel * appointmentDoctor = [[UILabel alloc]init];
    appointmentDoctor.text = @"预约医生：";
    appointmentDoctor.textColor= [UIColor grayColor];
    [self.view addSubview:appointmentDoctor];
    [appointmentDoctor mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(threadView.mas_bottom).offset(10);
        make.left.equalTo(self.view).offset(10);
    }];
    
    
    UIView * threadView2 = [[UIView alloc]init];
    threadView2.backgroundColor = [UIColor grayColor];
    [self.view addSubview:threadView2];
    
    [threadView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        //        线宽
        make.height.mas_equalTo(1);
        //        设置整条宽度
        make.width.mas_equalTo(self.view);
        make.top.equalTo(appointmentDoctor.mas_bottom).offset(10);
        
    }];
    
    if (kDevice_Is_iPhone5) {
        seeDoctorTime.font = [UIFont systemFontOfSize:16];
        
        
    }
    
    
    
    
    
    
    
    //    病人名
    _sickPersonName.text = self.model.sickPersonName;
    //    病名
    _diseaseName.text = self.model.diseaseName;
    //    就诊时间
    _seeDoctorTime.text = self.model.seeDoctorTime;
    if (!_model.is_check) {
        [_stateButton setTitle:@"审核中" forState:UIControlStateNormal];
        
    }else{
        [_stateButton setTitle:@"已就诊" forState:UIControlStateNormal];
        
    }
    
}
//设置医生区域
-(void)doctorUI{
    
    UILabel * doctorName= [[UILabel alloc]init];
    self.doctorName = doctorName;
    doctorName.text = @"马医生";
    [self.view addSubview:doctorName];
    [doctorName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(230);
        make.left.equalTo(self.view).offset(10);
    }];
    
    UILabel * doctorPosition = [[UILabel alloc]init];
    self.doctorPosition = doctorPosition;
    doctorPosition.text = @"主任医师";
    doctorPosition.textColor = [UIColor grayColor];
    [self.view addSubview:doctorPosition];
    [doctorPosition mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(doctorName);
        make.left.equalTo(doctorName.mas_right).offset(10);
    }];
    
    UILabel * hospitalName= [[UILabel alloc]init];
    self.hospitalName = hospitalName;
    hospitalName.text =@"上海长征医院";
    hospitalName.textColor = [UIColor grayColor];
    [self.view addSubview:hospitalName];
    [hospitalName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(doctorName.mas_bottom).offset(10);
        make.left.equalTo(self.view).offset(10);
    }];
    
    UIButton * feedbackButton = [[UIButton alloc]init];
    [feedbackButton setTitle:@"提交反馈" forState:UIControlStateNormal];
    feedbackButton.backgroundColor = [UIColor colorWithRed:57/255.0 green:197/255.0 blue:196/255.0 alpha:1];
    [self.view addSubview:feedbackButton];
    [feedbackButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(235);
        make.right.equalTo(self.view).offset(-10);
        make.width.equalTo(@100);
        make.height.equalTo(@40);
        
    }];
    
    UIView * threadView3 = [[UIView alloc]init];
    
    threadView3.backgroundColor = [UIColor grayColor];
    [self.view addSubview:threadView3];
    
    [threadView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        //        线宽
        make.height.mas_equalTo(1);
        //        设置整条宽度
        make.width.mas_equalTo(self.view);
        make.top.equalTo(hospitalName.mas_bottom).offset(20);
        
    }];
    
    UILabel * appointmentAttention = [[UILabel alloc]init];
    appointmentAttention.text = @"预约须知：";
    appointmentAttention.textColor= [UIColor grayColor];
    [self.view addSubview:appointmentAttention];
    [appointmentAttention mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(threadView3.mas_bottom).offset(10);
        make.left.equalTo(self.view).offset(10);
    }];
    
    
    UIView * threadView4 = [[UIView alloc]init];
    
    threadView4.backgroundColor = [UIColor grayColor];
    [self.view addSubview:threadView4];
    
    [threadView4 mas_makeConstraints:^(MASConstraintMaker *make) {
        //        线宽
        make.height.mas_equalTo(1);
        //        设置整条宽度
        make.width.mas_equalTo(self.view);
        make.top.equalTo(appointmentAttention.mas_bottom).offset(10);
        
    }];
    
    //    就诊地址
    UILabel * seeDoctorAddress = [[UILabel alloc]init];
    seeDoctorAddress.text = @"就诊地址：";
    [self.view addSubview:seeDoctorAddress];
    [seeDoctorAddress mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(threadView4.mas_bottom).offset(20);
        make.left.equalTo(self.view).offset(10);
    }];
    
    UILabel * seeDoctorAddressData = [[UILabel alloc]init];
    seeDoctorAddressData.textColor = [UIColor grayColor];
    seeDoctorAddressData.text = [NSString stringWithFormat:@"%@%@科",_model.hospitalName,_model.diseaseName];
    [self.view addSubview:seeDoctorAddressData];
    [seeDoctorAddressData mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(seeDoctorAddress);
        make.left.equalTo(seeDoctorAddress.mas_right).offset(10);
    }];
    
    NSMutableAttributedString *takeNumberTimeStr = [[NSMutableAttributedString alloc] initWithString:@"取号时间：      9:00 - 10:00"];
    [takeNumberTimeStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(11,12)];
    
    UILabel *takeNumberTime = [[UILabel alloc]init];
    takeNumberTime.attributedText =takeNumberTimeStr;
    [self.view addSubview:takeNumberTime];
    [takeNumberTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(seeDoctorAddress.mas_bottom).offset(10);
        make.left.equalTo(self.view).offset(10);
    }];
    
    /*
     NSMutableAttributedString *takeNumberAddressStr = [[NSMutableAttributedString alloc] initWithString:@"取号时间：      上海长征医院住院部"];
     [takeNumberAddressStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(11,9)];
     */
    UILabel *takeNumberAddress =[[UILabel alloc]init];
    takeNumberAddress.text =@"取号地址：";
    [self.view addSubview:takeNumberAddress];
    [takeNumberAddress mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(takeNumberTime.mas_bottom).offset(10);
        make.left.equalTo(self.view).offset(10);
    }];
    
    UILabel *takeNumberAddressData = [[UILabel alloc]init];
    takeNumberAddressData.textColor = [UIColor grayColor];
    takeNumberAddressData.text = [NSString stringWithFormat:@"%@大厅服务区",_model.hospitalName];
    [self.view addSubview:takeNumberAddressData];
    [takeNumberAddressData mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(takeNumberAddress);
        make.left.equalTo(takeNumberAddress.mas_right).offset(10);
    }];
    
    UIView * threadView5 = [[UIView alloc]init];
    
    threadView5.backgroundColor = [UIColor grayColor];
    [self.view addSubview:threadView5];
    
    [threadView5 mas_makeConstraints:^(MASConstraintMaker *make) {
        //        线宽
        make.height.mas_equalTo(1);
        //        设置整条长度
        make.width.mas_equalTo(self.view);
        make.top.equalTo(takeNumberAddress.mas_bottom).offset(20);
        
    }];
    
    UIButton* appointmentButton = [[UIButton alloc]init];
    appointmentButton.backgroundColor = [UIColor whiteColor];
    [appointmentButton setTitle:@"短信预约" forState:UIControlStateNormal];
    [appointmentButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    
    appointmentButton.layer.borderWidth = 1;
    appointmentButton.layer.borderColor=[UIColor colorWithRed:57/255.0 green:197/255.0 blue:196/255.0 alpha:1].CGColor;
    [appointmentButton.layer setCornerRadius:10.0]; //设置矩形四个圆角半径

    [self.view addSubview:appointmentButton];
    [appointmentButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(40);
        make.bottom.equalTo(self.view).offset(-20);
        make.width.equalTo(@120);
        
    }];
    
    
    UIButton * cancelButton = [[UIButton alloc]init];
    [cancelButton setTitle:@"取掉预约" forState:UIControlStateNormal];
    cancelButton.layer.borderWidth = 1;
    cancelButton.layer.borderColor=[UIColor colorWithRed:57/255.0 green:197/255.0 blue:196/255.0 alpha:1].CGColor;
    [cancelButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [cancelButton.layer setCornerRadius:10.0]; //设置矩形四个圆角半径

    [self.view addSubview:cancelButton];
    [cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view).offset(-40);
        make.bottom.equalTo(self.view).offset(-20);
        make.width.equalTo(appointmentButton);
    }];
    
    if (kDevice_Is_iPhone6Plus) {
        seeDoctorAddressData.font = [UIFont systemFontOfSize:18];
        takeNumberAddressData.font = [UIFont systemFontOfSize:18];
        
        
    }
    
    
    if(kDevice_Is_iPhone5) {
        seeDoctorAddressData.font = [UIFont systemFontOfSize:16];
        takeNumberAddressData.font = [UIFont systemFontOfSize:16];

    }
    
    //    医生名
    _doctorName.text = self.model.doctorName;
    //    医生职位
    _doctorPosition.text = self.model.doctorPosition;
    //    医院名
    _hospitalName.text = self.model.hospitalName;
    
}

@end












